setwd("/Volumes/Data/localDataNoBackup/sfer9710/Development/smfrgsn-devel/Loudness2/CodeProcessing/PlotSubjectiveDataAgainstLoudness/")
getwd()
library(lattice)
library(latticeExtra)
library(ggplot2)
library(ggExtra)


ld = read.table("../LoudnessData.txt",header=TRUE,sep="\t")
ld3=ld;
ld3$Familiar = ld3$Familiarity %in% c("Yes","HeardItSomewhere")  
ld3 = subset(ld3, PresOrder < 9)
ld3= aggregate(SubjectiveData ~ Time+File+Permutation+Familiar, data = ld3, mean)
levels(ld3$File) <- c("Dvorak-Fwd","Bach-Prelude","Bjork-IOSQ","Dvorak-Rev","RLee-San'ya","ElliotS-SA")
ld3$File = factor(ld3$File,levels= c("Dvorak-Fwd","Dvorak-Rev","ElliotS-SA","Bjork-IOSQ","RLee-San'ya","Bach-Prelude"))
levels(ld3$Permutation) <- c("-3dB","0dB","6dB","12dB","24dB","Orig") `


p = ggplot(ld3,aes(Time,SubjectiveData,grouping=Familiar,colour=Familiar)) + geom_line() + facet_grid(File~Permutation) +xlab("Time(s)") + theme_minimal()
p